﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Mammoth.Entities
{
    public abstract class Entity : INotifyPropertyChanged
    {
        public Entity()
        {
            Id = -1;
            CreateDate = DateTime.Now;
        }

        [Key]
        public long Id { get; set; }
        public DateTime CreateDate { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
